using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class so_cust_BalMap : EntityTypeConfiguration<so_cust_Bal>
    {
        public so_cust_BalMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Salesman, t.Currency });

            // Properties
            this.Property(t => t.ID)
                .HasMaxLength(6);

            this.Property(t => t.Customer)
                .HasMaxLength(110);

            this.Property(t => t.Salesman)
                .IsRequired()
                .HasMaxLength(30);

            this.Property(t => t.Address)
                .HasMaxLength(236);

            this.Property(t => t.phones)
                .HasMaxLength(30);

            this.Property(t => t.PAGER)
                .HasMaxLength(12);

            this.Property(t => t.Account__)
                .HasMaxLength(20);

            this.Property(t => t.Currency)
                .IsRequired()
                .HasMaxLength(5);

            // Table & Column Mappings
            this.ToTable("so_cust_Bal");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.Customer).HasColumnName("Customer");
            this.Property(t => t.Salesman).HasColumnName("Salesman");
            this.Property(t => t.Address).HasColumnName("Address");
            this.Property(t => t.phones).HasColumnName("phones");
            this.Property(t => t.PAGER).HasColumnName("PAGER");
            this.Property(t => t.HasNotes).HasColumnName("HasNotes");
            this.Property(t => t.Account__).HasColumnName("Account_#");
            this.Property(t => t.Currency).HasColumnName("Currency");
            this.Property(t => t.Net_Invoices).HasColumnName("Net_Invoices");
            this.Property(t => t.Net_Orders).HasColumnName("Net_Orders");
            this.Property(t => t.Net_Payments).HasColumnName("Net_Payments");
            this.Property(t => t.Invoice_Balance).HasColumnName("Invoice_Balance");
            this.Property(t => t.Inv_Order_Balance_).HasColumnName("Inv_Order_Balance_");
        }
    }
}
